package 面试.OOM;/*
 *@Author: helen
 *@Date:   2021/7/30 15:32
 *@Description:
 */

public class demo01 {
    public static void main(String[] args) {
        //虚拟机试图使用的最大内存
        long max = Runtime.getRuntime().maxMemory();
        //jvm初始化的总内存
        long total = Runtime.getRuntime().totalMemory();

        System.out.println("max" + max + "字节\t" + max/(double)1024/1024 + "MB\t" + max/(double)1024/1024/1024 + "G");
        System.out.println("total" + max + "字节\t" + total/(double)1024/1024 + "MB\t" + total/(double)1024/1024/1024 + "G");
    }
}
